<?php
/**
 * Created by PhpStorm
 * User: ZhouFurong
 * Date: 2020/12/3
 * Time: 17:52
 */

namespace App\Adapter;

class SqlAdapter
{
    // 适配器
    // 将一个类的接口，转换成可应用的兼容接口。适配器使原本不兼容而不能一起工作的那些类可以一起工作
    protected $server;

    public function __construct(SqlAdapterInter $server)
    {
        $this->server = $server;
    }

    public function init()
    {
        $this->server->connection();
    }
}

$mysqlAdapter = (new SqlAdapter(new Mysql()));
$mysqlAdapter->init();